package LinkList;

import java.util.LinkedList;

/**
 * @author lijunhao
 * 2023/7/17
 * @description TODO
 */
public class Stack {
    private LinkedList<Integer> stack;

    public Stack() {
        stack = new LinkedList<>();
    }

    public void push(int value) {
        stack.addFirst(value);
    }

    public int pop() {
        if (isEmpty()) {
            throw new IllegalStateException("Stack is empty");
        }
        return stack.removeFirst();
    }

    public boolean isEmpty() {
        return stack.isEmpty();
    }
}
